package com.fdb.efp.nls.service.common.rules.apply;

import com.fdb.basic.framework.core.constant.EsbRetCodeStandard;
import com.fdb.basic.framework.core.exception.BizException;
import com.fdb.efp.nls.service.common.rules.CheckRule;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 需求编号:2019D08--
 * 问题编号:
 * 开发人员: caoxin
 * 创建日期:2020/1/17
 * 功能描述:
 * 修改日期:2020/1/17
 * 修改描述:
 */
public class LmtExpireRule implements CheckRule {
    private static Logger logger = LoggerFactory.getLogger(LmtExpireRule.class);
    private String exprireDate;
    private String openDay;
    private String applyNo;

    public LmtExpireRule(String exprireDate,String applyNo,String openDay) {
        this.exprireDate = exprireDate;
        this.applyNo = applyNo;
        this.openDay = openDay;
    }

    @Override
    public void check() throws BizException {
        if (openDay.compareTo(exprireDate) > 0) {
            logger.error("用信申请流水号【" + applyNo + "】，获取的授信额度有效期已经失效！");
            throw new BizException(EsbRetCodeStandard.WFJKYWGZ.getValue(), "用信申请流水号【" + applyNo + "】，获取的授信额度有效期已经失效！");
        }
    }
}
